<?php
if (isset($_POST['s'])) {
$appId='wxe214ac48790c622f';
$secret='6b7153fc9c94ee2008e71ecbb2313bec';
include 'jssdk.php';
$jssdk = new JSSDK($appId, $secret);
$signPackage = $jssdk->GetSignPackage();
$accessToken=$jssdk->getAccessToken();
 
$url='https://api.weixin.qq.com/cgi-bin/media/get?access_token='.$accessToken.'&media_id='.$_POST['s'];

 

 $data=file_get_contents($url);
 
 $fileName=time().rand(1,99).'.jpg';

 file_put_contents('./upload/'.$fileName, $data);
 
 echo json_encode(array('f' =>$fileName));
 


	 
}

